﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <% 
        var lstDienThoai = Model.DienThoaiModel.GetModel.LstObjModel.OrderByDescending(n2 => n2.SanPham.GiaBan).ToList();
        var numRow = lstDienThoai.Count % 4 == 0 ? lstDienThoai.Count / 4 : (lstDienThoai.Count / 4 + 1);
    %>
    <div id="DivTinTucVTA" style="display: block;">
        <table id="VTA_LoadContent_ctl00_VTA_LoadBody1_TblLoadQuanCao" style="width: 100%;
            border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0">
            <tbody>
                <tr>
                    <td style="width: 100%;" valign="top">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td class="maintabletitlebg" align="center" height="42">
                                        <h1>
                                            Điện thoại <%= Model.SelectedNhaSanXuatModel.GetModel.LstObjModel[0].TenNhaSanXuat %></h1>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="graytdborder" style="border-right-width: 0px ! important;" align="center">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tbody>
                                                <% var ItemIndex = 0;
                                                   for (int i = 0; i < numRow; i++)
                                                   { %>
                                                <tr>
                                                    <% for (int j = ItemIndex; j < lstDienThoai.Count; j++)
                                                       { %>
                                                    <td class="tdcell" align="center" width="100%">
                                                        <div class="product">
                                                            <p>
                                                            </p>
                                                            <center>
                                                                <a class="producttitle" href="<%= Url.Action("ChiTietDienThoai", "Home", new { id = lstDienThoai[j].ID }) %>">
                                                                    <%= lstDienThoai[j].SanPham.TenSanPham %>
                                                                </a>
                                                            </center>
                                                            <p>
                                                            </p>
                                                            <table width="94%" border="0" cellpadding="0" cellspacing="0">
                                                                <tbody>
                                                                    <tr>
                                                                        <td width="43%">
                                                                            <center>
                                                                                <a href="<%= Url.Action("ChiTietDienThoai", "Home", new { id = lstDienThoai[j].ID }) %>">
                                                                                    <img name="HinhSanPham" src="../../Content/Images/Items/<%= lstDienThoai[j].SanPham.HinhMinhHoa %>"
                                                                                        height="120" border="0" />
                                                                                </a>
                                                                            </center>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="height: 5px;">
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="ad" align="center" width="57%">
                                                                            &nbsp;
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="center">
                                                                            <span class="price">
                                                                                <%= string.Format("{0:0,0}", lstDienThoai[j].SanPham.GiaBan.Value)%>
                                                                                VNĐ</span>
                                                                        </td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </td>
                                                    <% ItemIndex++;
                                                       if (ItemIndex > 0 && ItemIndex % 4 == 0)
                                                       {
                                                           break;
                                                       }
                                                                                       } %>
                                                </tr>
                                                <% } %>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="height: 5px; width: 100%;" valign="top">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</asp:Content>
